package com.lihaogn.sell.mapper;

import com.lihaogn.sell.entity.FoodCookCategory;
import com.lihaogn.sell.entity.FoodMaterial;
import com.lihaogn.sell.entity.FoodTypeCategory;
import org.apache.ibatis.annotations.Mapper;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @FileName: ProductCategoryMapper
 * @Description: 商品种类-数据库操作
 * @Author: lihao
 * @Date: 2019-05-14 10:48
 * @Version: 1.0
 */
@Mapper
public interface ProductCategoryMapper {

    // ================ 查询操作 ================

    /**
     * 查询所有食材信息
     * @return 食材列表
     */
    List<FoodMaterial> queryAllFoodMaterial();

    /**
     * 根据id查询食材
     * @param foodMaterialTempId
     * @return
     */
    FoodMaterial queryFoodMaterialById(int foodMaterialTempId);

    /**
     * 根据id查询typeCategory
     * @param categoryId
     * @return
     */
    FoodTypeCategory queryFoodTypeCategoryById(String categoryId);

    /**
     * 根据id查询cookCategory
     * @param categoryId
     * @return
     */
    FoodCookCategory queryFoodCookCategoryById(String categoryId);

    /**
     * 查询cook分类name是否已经存在
     * @param cookName
     * @return
     */
    int queryExistCookName(String cookName);

    /**
     * 查询type分类name是否已经存在
     * @param typeName
     * @return
     */
    int queryExistTypeName(String typeName);

    /**
     * 查询食材名称是否存在
     * @param name
     * @return
     */
    int queryExistMaterialName(String name);

    /**
     * 查询所有的荤素类别
     * @return
     */
    List<FoodTypeCategory> queryAllFoodTypeCategory();


    /**
     * 查询所有做法类别
     * @return
     */
    List<FoodCookCategory> queryAllFoodCookCategory();

    // ================ 插入操作 ================

    /**
     * 插入一个cook category
     * @param foodCookCategory
     * @return
     */
    int insertOneFoodCookCategory(FoodCookCategory foodCookCategory);

    /**
     * 插入一个type category
     * @param foodTypeCategory
     * @return
     */
    int insertOneFoodTypeCategory(FoodTypeCategory foodTypeCategory);

    /**
     * 添加一个食材类别
     * @param foodMaterial 食材对象
     * @return 修改记录条数
     */
    int insertFoodMaterial(FoodMaterial foodMaterial);

    // ================ 更新操作 ================

    /**
     * 更新一个cook category
     * @param foodCookCategory
     * @return
     */
    int updateOneFoodCookCategory(FoodCookCategory foodCookCategory);

    /**
     * 更新一个type category
     * @param foodTypeCategory
     * @return
     */
    int updateOneFoodTypeCategory(FoodTypeCategory foodTypeCategory);

    /**
     * 更新一个食材信息
     * @param foodMaterial
     * @return
     */
    int updateFoodMaterial(FoodMaterial foodMaterial);

    // ================ 删除操作 ================

    /**
     * 删除一个cook category
     * @param foodCookCategoryId
     * @return
     */
    int deleteOneFoodCookCategory(String foodCookCategoryId);

    /**
     * 删除一个type category
     * @param foodTypeCategoryId
     * @return
     */
    int deleteOneFoodTypeCategory(String foodTypeCategoryId);

    /**
     * 删除单个食材记录
     * @param materialId
     * @return
     */
    int deleteOneFoodMaterial(int materialId);

    /**
     * 删除多个cook category
     * @param map
     * @return
     */
    int deleteMultiFoodCookCategory(Map<String,Object> map);

    /**
     * 删除多个type category
     * @param map
     * @return
     */
    int deleteMultiFoodTypeCategory(Map<String,Object> map);


    /**
     * 删除多个食材记录
     * @param map
     * @return
     */
    int deleteMultiFoodMaterial(Map<String, Object> map);
}
